import {
  useState,
  useEffect
} from 'react'

export default function useGetInfoHook() {
  const [ulListRes, setUlListRes] = useState([])

  useEffect(() => {
    init()
  }, [])

  async function init() {
    const res = await fetch('http://geek.itheima.net/v1_0/channels')
    const listRes = await res.json()
    setUlListRes(listRes.data.channels)
  }

  return {
    setUlListRes,
    ulListRes
  }

}